package wog.dubo.business.film.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wog.dubo.business.film.dao.DataFilmDao;
import wog.dubo.business.film.model.DataFilm;
import wog.dubo.business.film.service.FilmService;

import java.sql.SQLException;

@Service
public class FilmServiceImpl implements FilmService{
    @Autowired
    private DataFilmDao dataFilmDao;

    /**
     * 根据id查询电影
     */
    public DataFilm getFilmById(Long id){

        return dataFilmDao.selectFilmById(id);
    }

    /**
     * 新增电影
     */
    public Integer addFilm(DataFilm dataFilm) throws SQLException {
        Integer i = dataFilmDao.addFilm(dataFilm);
        if (i<1){
            throw new SQLException();
        }
        return i;

    }

}
